// components/p2_navigator/p2_navigator.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    tabs:[
      {
        id:0,
        name:"日记",
        isActive:true
      },
      {
        id:1,
        name:"待办",
        isActive:false
      }
    ],

    dairyList:[
      {
        texts:"一剑霜寒十四州",
        releasetime:"2021-12-13 20:26:14"
      },
      {
        texts:"一剑霜寒十四州",
        releasetime:"2021-12-13 20:26:14"
      },
      {
        texts:"一剑霜寒十四州",
        releasetime:"2021-12-13 20:26:14"
      },
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    hanldeItemTap(e){
      const {index}=e.currentTarget.dataset;
      let{tabs}=this.data;
      tabs.forEach((v,i)=>i==index?v.isActive=true:v.isActive=false);
      this.setData({
        tabs
      }
      )
    }
  }
})
